﻿using System;

namespace Is
{
    public static class IsNullableBoolFluentExtensions
    {
        public static bool True(this IIs<bool?> iser)
        {
            Func<bool?, bool> positiveCase = t => t.HasValue && Core.Is.True(t.Value);
            Func<bool?, bool> negativeCase = t => !t.HasValue || Core.Is.False(t.Value);
            return iser.Apply(positiveCase, negativeCase);
        }

        public static bool False(this IIs<bool?> iser)
        {
            Func<bool?, bool> positiveCase = t => t.HasValue && Core.Is.False(t.Value);
            Func<bool?, bool> negativeCase = t => !t.HasValue || Core.Is.True(t.Value);
            return iser.Apply(positiveCase, negativeCase);
        }
    }
}